﻿using System.Collections.Generic;
using System.Linq;
using MovieAPI.Models;
namespace MovieAPI.DAL
{
    public class OrderDAL
    {

        /// <summary>
        /// 获取所有订单信息
        /// </summary>
        /// <returns></returns>
        public static List<Orderinfo> GetOrderinfos()
        {
            using (filmEntities db = new filmEntities())
            {
                return db.Orderinfo.ToList();
            }

        }
        /// <summary>
        /// 通过用户ID获取订单信息
        /// </summary>
        /// <param name="UID"></param>
        /// <returns></returns>
        public static List<Orderinfo> GetOrderinfosByUID(int UID)
        {
            using (filmEntities db = new filmEntities())
            {
                return db.Orderinfo.Where(O => O.UserID == UID).ToList();
            }

        }
    }
}